CentOS 7
Sponsored Link

Use mod_proxy_wstunnel
2015/08/16
 
Enable mod_proxy_wstunnel module to set WebSocket Proxy.
[1] For example, configure httpd to set proxy on /chat for an application which listens on localhost:1337.
The sample application is from here (section [3]).
[root@www ~]#
vi /etc/httpd/conf.modules.d/00-proxy.conf
# add to the end

LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
[root@www ~]#
vi /etc/httpd/conf.d/wstunnel.conf
# create new

ProxyRequests Off
<Proxy *>
    Require all granted
</Proxy>

ProxyPass /socket.io/ http://127.0.0.1:1337/socket.io/
ProxyPassReverse /socket.io/ http://127.0.0.1:1337/socket.io/

ProxyPass /chat http://127.0.0.1:1337/
ProxyPassReverse /chat http://127.0.0.1:1337/

[root@www ~]#
systemctl restart httpd

[2] If SELinux is enabled, change rules like follows.
[root@www ~]#
semanage port -a -t http_port_t -p tcp 1337

[3] Access to the sample App to make sure it works normally on proxy environment.
 
Tweet